package cn.buk.qms.config;

import cn.buk.alert.service.AlertService;
import cn.buk.alert.service.AlertServiceImpl;
import cn.buk.api.wechat.service.WeixinService;
import cn.buk.api.wechat.service.WeixinServiceImpl;
import cn.buk.api.wechat.work.service.WorkWeixinService;
import cn.buk.api.wechat.work.service.WorkWeixinServiceImpl;
import cn.buk.qms.performance.DaoPerformance;
import org.springframework.context.annotation.*;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.context.support.ResourceBundleMessageSource;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;

/**
 *
 * @author yfdai
 * @date 2016/12/3
 */
@Configuration
@PropertySource(value="classpath:config.properties")
@ComponentScan(basePackages = {"cn.buk"},
        excludeFilters = {
            @ComponentScan.Filter(type= FilterType.ANNOTATION, value = EnableWebMvc.class)
        })
public class RootConfig {

    @Bean
    public static PropertySourcesPlaceholderConfigurer placeholderConfigurer() {
        return new PropertySourcesPlaceholderConfigurer();
    }

    @Bean
    public DaoPerformance createDaoPerformance() {
        return new DaoPerformance();
    }

    @Bean
    public WorkWeixinService createWorkWeixinService() {
        return new WorkWeixinServiceImpl(true);
    }

    @Bean
    public static WeixinService createWeixinService() {
        return new WeixinServiceImpl();
    }



//    @Bean
//    public LocaleResolver localeResolver() {
//        var sessionLocaleResolver = new SessionLocaleResolver();
//        sessionLocaleResolver.setDefaultLocale(Locale.US);
//        return sessionLocaleResolver;
//    }

//    @Bean
//    public ResourceBundleMessageSource messageSource() {
//        var messageSource = new ResourceBundleMessageSource();
//        messageSource.setBasenames("messages");
//        messageSource.setUseCodeAsDefaultMessage(true);
//        return messageSource;
//    }


}
